#!/usr/bin/python
# -*- coding: utf8 -*-

#######################################################
## 操作sqlite数据库
# 1、创建数据库
# 2、创建表单
#######################################################

import sqlite3

# 连接数据库
conn = sqlite3.connect('test.db')
print("Opened database successfully")

c = conn.cursor()
# 创建表
c.execute('''CREATE TABLE COMPANY
    (ID INT PRIMARY KEY NOT NULL,
    NAME    TEXT    NOT NULL,
    AGE INT NOT NULL,
    ADDRESS CHAR(50),
    SALARY  REAL);'''
)
print("Table created successfully")

conn.commit()
conn.close()